# -*- coding: utf-8 -*-
# @Time    : 2021/12/13 20:24
# @Author  : robin
# @Email   : xxxxxxxxxxx@xxx.com
# @File    : database.py
# @Software: PyCharm

import os

import pymysql

MYSQL_HOST = os.environ.get("MYSQL_HOST", "192.168.137.140")
MYSQL_USER = os.environ.get("MYSQL_USER", "root")
MYSQL_PASS = os.environ.get("MYSQL_PASS", "public")
MYSQL_DB = os.environ.get("MYSQL_DB", "douban")

connection = pymysql.connect(
    host=MYSQL_HOST,
    user=MYSQL_USER,
    password=MYSQL_PASS,
    db=MYSQL_DB,
    charset="utf8mb4",
    port=3307,
    cursorclass=pymysql.cursors.DictCursor,
)
